import API from "./urls";
import HttpClient from "utils/request";

/**
 * 发送ajax请求
 * @param {any} options 请求参数
 * @param {string} url 请求地址
 * @param {string} method 请求类型
 * @returns {any}
 */
const send = options => {
    return HttpClient({
        ...options,
    });
};

export default {
    // user
    login: data => send({ url: API.login, data, method: "post" }), // 登录接口
    logout: data => send({ url: API.logout, method: "post" }), // 退出接口
    getExam: params => send({ url: API.getExam, params, method: "get" }), // 考试列表
    confirmExam: data => send({ url: API.confirmExam, data, method: "post" }), // 确认考试
    getExamDes: params => send({ url: API.getExamDes, params, method: "get" }), // 获取考试内容
    getTrainPaper: params => send({ url: API.getTrainPaper, params, method: "get" }),
    saveTrainPaper: data => send({ url: API.getTrainPaper, data, method: "post" }),
    getQuestionContent: params => send({ url: API.getQuestionContent, params, method: "get" }),
    saveScore: data => send({ url: API.saveScore, data, method: "post" }),
    getScore: params => send({ url: API.saveScore, params, method: "get" }),
    submitExam: data => send({ url: API.submitExam, data, method: "post" }),
    getQuestionBank: params => send({ url: API.getQuestionBank, params, method: "get" }),
    saveTrain: data => send({ url: API.saveTrain, data, method: "post" }),
    getTrainDes: params => send({ url: API.getTrainDes, params, method: "get" }), // 获取考试内容
    getTrainContent: params => send({ url: API.getTrainContent, params, method: "get" }),
    getTrainScore: params => send({ url: API.trainScore, params, method: "get" }),
    saveTrainScore: data => send({ url: API.trainScore, data, method: "post" }),
    submitTrain: data => send({ url: API.submitTrain, data, method: "post" }),
    getExamScore: params => send({ url: API.getExamScore, params, method: "get" }), //
    getStudentExam: params => send({ url: API.getStudentExam, params, method: "get" }),
    getNotice: params => send({ url: API.getNotice, params, method: "get" }),
    trainConfirm: data => send({ url: API.trainConfirm, data, method: "post" }),
    getQuestionAnswer: params => send({ url: API.getQuestionAnswer + params, method: "get" }), //
    getTrainQuestionAnswer: params =>
        send({ url: API.getTrainQuestionAnswer + params, method: "get" }), //
    getSubject: params => send({ url: API.getSubject, params, method: "get" }),
    getExamAnalysis: params => send({ url: API.getExamAnalysis, params, method: "get" }),
    getTrainAnalysis: params => send({ url: API.getTrainAnalysis, params, method: "get" }),
    //getTrainScore: params => send({ url: API.trainScore, params, method: "get" }),
};
